#!/usr/bin/env python2
PACKAGE = "metavision_driver"

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()
# default values are for SilkyEVCam #0198

# bias for on events (compared to bias_diff)
# range from bias_diff + 1 to 1800
gen.add("bias_diff_on", int_t, 0, "on threshold level", 350, -85, 499);

# bias for off events (compared to bias_diff)
# range from zero to bias_diff - 1
gen.add("bias_diff_off", int_t, 0, "off threshold level", 384, -35, 298);

# From metavision documentation:
#
# In Gen3, "bias_fo" is a voltage, in mV. Decreasing "bias_fo" value will increase the
# bandwidth (make the sensor faster) and also increase the background noise.
# Increasing "bias_fo" value will decrease both speed and noise

# In Gen4, "bias_fo" is Idac value. Increasing "bias_fo" value will increase the bandwidth
# (make the sensor faster) and also increase the background noise. Decreasing "bias_fo"
# value will decrease both speed and noise

gen.add("bias_fo", int_t, 0, "source follower low pass filter", 1477, -35, 1800);

#
# From metavision documentation:
#
# High-Pass Filter (bias_hpf) controls the strength of a High-Pass Filter that removes low
# frequency noise (spontaneous background activity):
#
# In Gen3, With low "bias_hpf" values, high frequencies are filtered out, but if the
# value is too low, the quality of the signal can be impacted.
#
# In Gen4, with high "bias_hpf" values, low frequencies are filtered out, but if the
# value is too high, the quality of the signal can be impacted.

gen.add("bias_hpf", int_t, 0, "differentiator high pass filter", 1499, 0, 1800);

#
# From metavision documentation:
#
# controls the front-end part of the pixel, the photoreceptor bandwidth.
# High "bias_pr" value leads to small bias currents in the amplifier, hence limiting the
# bandwidth of the photoreceptor. We recommend not changing this bias, unless very
# specific conditions.
gen.add("bias_pr", int_t, 0, "photoreceptor (frontend) bias", 1500, 0, 1800);

#
# From metavision documentation:
#
# sets the "refractory period" during which the Change Detector is switched
# off after generating an event. This parameter controls the sampling rate of
# the pixels and hence the output data rate of the sensor.

gen.add("bias_refr", int_t, 0, "refractory time bias", -20, 0, 1800);
exit(gen.generate(PACKAGE, "metavision_driver", "MetaVisionDyn"))
